from django.urls import path, include
from rest_framework.routers import DefaultRouter
from . import views
from .migrations import CATEGORY_AUTH, CATEGORY_TERMINAL, CATEGORY_RESOURCE

router = DefaultRouter(trailing_slash=False)
router.register(r'config', views.StrategyViewSet)
router.register(r'trigger/stats', views.StrategyTriggerViewSet)
router.register(r'senword', views.SensitiveWordViewSet)
router.register(r'secretfile', views.SecretFileViewSet)
router.register(r'global/state', views.StrategyGlobalActionViewSet)
router.register(r'global', views.StrategyGlobalConfigViewSet)
router.register(r'credit/global', views.StrategyCreditGlobalViewSet)
router.register(r'credit/config', views.StrategyCreditConfigViewSet)
router.register(r'credit/score', views.StrategyCreditScoreViewSet)
router.register(r'credit/basic', views.StrategyCreditBasicViewSet)

urlpatterns = [
    path('', include(router.urls)),
    path(f'judgment/user/location', views.NewLoginLocationView.as_view()),   # 用户异地登录
    path(f'judgment/device/location', views.DeviceLoginLocationView.as_view()),   # 设备异地登录
    path(f'judgment/{CATEGORY_TERMINAL[1]}-1', views.NewLoginDeviceView.as_view()),
    path(f'judgment/{CATEGORY_RESOURCE[1]}-4', views.AnomalyDetectionView.as_view()),
    path('trigger/count', views.strategy_trigger_count),
    path('trigger/trend', views.strategy_trigger_trend),
    path('dispatch/count', views.strategy_dispatch_count),
    path('risk', views.strategy_risk_level),
    path("groups", views.strategy_group),
    path("summary", views.strategy_summary),
    path("screening", views.strategy_screening),
    path("trend", views.strategy_trend)
]
